package com.ruoyi.project.wms.customerorder.service.impl;

import java.util.List;

import com.ruoyi.project.wms.space.domain.WmsStroeSpace;
import com.ruoyi.project.wms.space.mapper.WmsStroeSpaceMapper;
import com.ruoyi.project.wms.status.domain.WmsCustomerStatus;
import com.ruoyi.project.wms.status.mapper.WmsCustomerStatusMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.wms.customerorder.mapper.WmsCustomerOrderMapper;
import com.ruoyi.project.wms.customerorder.domain.WmsCustomerOrder;
import com.ruoyi.project.wms.customerorder.service.IWmsCustomerOrderService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 出库订单信息表Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-10-29
 */
@Service
public class WmsCustomerOrderServiceImpl implements IWmsCustomerOrderService 
{
    @Autowired
    private WmsCustomerOrderMapper wmsCustomerOrderMapper;
    @Autowired
    private WmsStroeSpaceMapper wmsStroeSpaceMapper;

    @Autowired
    private WmsCustomerStatusMapper wmsCustomerStatusMapper;
    /**
     * 查询出库订单信息表
     * 
     * @param customerOrderId 出库订单信息表ID
     * @return 出库订单信息表
     */
    @Override
    public WmsCustomerOrder selectWmsCustomerOrderById(Integer customerOrderId)
    {
        return wmsCustomerOrderMapper.selectWmsCustomerOrderById(customerOrderId);
    }

    /**
     * 查询出库订单信息表列表
     * 
     * @param wmsCustomerOrder 出库订单信息表
     * @return 出库订单信息表
     */
    @Override
    public List<WmsCustomerOrder> selectWmsCustomerOrderList(WmsCustomerOrder wmsCustomerOrder)
    {
        return wmsCustomerOrderMapper.selectWmsCustomerOrderList(wmsCustomerOrder);
    }

    public WmsStroeSpace selectWmsStroeSpaceByPid(Integer pId){
        return wmsStroeSpaceMapper.selectWmsStroeSpaceByPId(pId);
    }

    /**
     * 新增出库订单信息表
     * 
     * @param wmsCustomerOrder 出库订单信息表
     * @return 结果
     */
    @Override
    public int insertWmsCustomerOrder(WmsCustomerOrder wmsCustomerOrder)
    {
        int i= wmsCustomerOrderMapper.insertWmsCustomerOrder(wmsCustomerOrder);
        if (i>0){
            //WmsCustomerStatus wmsCustomerStatus = new WmsCustomerStatus();
            System.out.println(wmsCustomerOrder);
            //wmsCustomerStatus.setoCid(wmsCustomerStatus.getCustomerOrderId());
            wmsCustomerStatusMapper.insertWmsCustomerStatus02(wmsCustomerOrder.getCustomerOrderId());

        }
        return i;
    }

    /**
     * 修改出库订单信息表
     * 
     * @param wmsCustomerOrder 出库订单信息表
     * @return 结果
     */
    @Override
    public int updateWmsCustomerOrder(WmsCustomerOrder wmsCustomerOrder)
    {
        return wmsCustomerOrderMapper.updateWmsCustomerOrder(wmsCustomerOrder);
    }

    /**
     * 删除出库订单信息表对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWmsCustomerOrderByIds(String ids)
    {
        return wmsCustomerOrderMapper.deleteWmsCustomerOrderByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除出库订单信息表信息
     * 
     * @param customerOrderId 出库订单信息表ID
     * @return 结果
     */
    @Override
    public int deleteWmsCustomerOrderById(Integer customerOrderId)
    {
        return wmsCustomerOrderMapper.deleteWmsCustomerOrderById(customerOrderId);
    }
}
